package com.cloud.mall.oms.service.impl;

import com.cloud.mall.base.BaseResponse;
import com.cloud.mall.core.bean.MallBeanUtils;
import com.cloud.mall.oms.dto.OmsOrderReturnApplyParam;
import com.cloud.mall.oms.mapper.OmsOrderReturnApplyMapper;
import com.cloud.mall.oms.model.OmsOrderReturnApply;
import com.cloud.mall.oms.service.OmsPortalOrderReturnApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class OmsPortalOrderReturnApplyServiceImpl implements OmsPortalOrderReturnApplyService {
    @Autowired
    private OmsOrderReturnApplyMapper returnApplyMapper;
    @Override
    public BaseResponse create(OmsOrderReturnApplyParam returnApply) {
        OmsOrderReturnApply realApply= MallBeanUtils.doToDto(returnApply,OmsOrderReturnApply.class);
        realApply.setCreateTime(new Date());
        realApply.setStatus(0);
        int count= returnApplyMapper.insert(realApply);
        if(count==0){
            return  BaseResponse.setResultError();
        }
        return  BaseResponse.setResultSuccess(count);
    }
}
